import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;

/******************************************************************************
 * <p>
 * File: hero.java
 * </p>
 * @author  Tadhg O'Sullivan, rogue
 * @author <a href="mailto:tadhg.osullivan@ucdconnect.ie">tadhg.osullivan@ucdconnect.ie</a>
 * @version 1.0, 2007
 * @created 22-Feb-07 5:54:57 PM
 * @revised 22-Feb-07
 * Copyright 2007 Tadhg O'Sullivan
 * <p>
 * Description: Create a hero object, which extends sprite.java and has its
 * own getter and setter methods
 * </p>
 *  <p>
 *  This file is part of Retribution.
 *  </p>
 *  <p>
 *  Retribution is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Retribution is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Retribution; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *  <p>
 *****************************************************************************/

public class hero extends sprite{
	
	public boolean up,down,left,right, house, moved;
	
	/**
	 * 
	 * @param i The BufferedImage for the tile
	 * @param n The number used to reference the tile
	 * @param x The x coordinate of the tile
	 * @param y The y coordinate of the tile
	 * @param h The health of the sprite
	 * @param a The attack strength of the sprite
	 * @param b The boolean for whether the sprite is alive
	 */
	public hero(BufferedImage i, int n, int x, int y, int h, int a, boolean b) {
		super(i, n, x, y, h, a, b);
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * 
	 * @return String A String which says whether the user is trying to move the hero sprite
	 */
	public String getMovement(){
		moved = false;
		if(up == true){
			return "up";
		}
		if(down == true){
			return "down";
		}
		if(left == true){
			return "left";
		}
		if(right == true){
			return "right";
		}
		return "null";
	}
	
	/**
	 * Return the movement booleans to false
	 *
	 */
	public boolean setMoved(){
		up = false;
		down = false;
		left = false;
		right = false;
		moved = true;
		return moved;
	}
	
	public boolean setHouse(boolean h){
		this.house = h;
		return house;
	}
	
	public boolean getHouse(){
		return house;
	}

	/**
	 * TODO add getter and setter methods
	 */
	// key events
	 public void keyTyped(KeyEvent e) {
			String keyChar = "";
			keyChar += e.getKeyChar();
			//System.out.println(keyChar);
		   	if(keyChar.equalsIgnoreCase("w")){
		   		up = true;
		   	}else if(keyChar.equalsIgnoreCase("a")){
		   		left = true;
		   	}else if(keyChar.equalsIgnoreCase("d")){
		   		right = true;
		   	}else if(keyChar.equalsIgnoreCase("s")){
		   		down = true;
		   	}
		  }
}
